#include "originalimagewindow.h"
#include <QVBoxLayout>
#include<QPushButton>


OriginalImageWindow::OriginalImageWindow(QWidget *parent)
    : QWidget(parent)
{
    setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::WindowMinMaxButtonsHint);
    setAttribute(Qt::WA_TranslucentBackground);

    m_imageLabel = new QLabel(this);
    m_imageLabel->setAlignment(Qt::AlignCenter);
    m_imageLabel->setStyleSheet(
        "QLabel {"
        "  border: 2px solid #4CAF50;"
        "  border-radius: 10px;"
        "  background: rgba(255, 255, 255, 220);"
        "  padding: 5px;"
        "}"
        );

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(m_imageLabel);
    layout->setContentsMargins(0, 0, 0, 0);

    // 设置窗口大小，确保图片能够显示
    setMinimumSize(200, 200);
}


void OriginalImageWindow::setImage(const QPixmap &pixmap)
{
    QPixmap scaled = pixmap.scaled(200, 200, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    m_imageLabel->setPixmap(scaled);
    adjustSize();
}
